home *** CD-ROM | disk | FTP | other *** search
- Path: news.infi.net!usenet
- From: nngis@norfolk.infi.net (Greg DiGiorgio)
- Newsgroups: comp.lang.c
- Subject: Re: Hidding the cursor
- Date: 14 Jan 1996 23:50:14 GMT
- Organization: Customer of InfiNet
- Message-ID: <4dc4rm$13m@news.infi.net>
- References: <4d71rq$22e@alpha.delta.edu>
- NNTP-Posting-Host: h-langoliers.norfolk.infi.net
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.3
-
- In article <4d71rq$22e@alpha.delta.edu>, mcgiddin@alpha.delta.edu says...
- >
- > Could someone help me out, or at least point me in the right direction
- >here. I'm trying to hide the cursor in a small program that I'm
- writing,
- >but I cannot figure out how to do it using ANSI C code.
-
- *** You can't hide the cursor using ANSI 'C'. You have to resort to
- *** platform specific code to do that, sorry. Here's the solution in
- *** MS-DOS assembler. You can port it to MS-C or Borland-C using their
- *** "int86" routine".
-
- ;************************************************************************
- ****
- ;Function Header Example Description
- ;---------- -----------------------
- -------------------------------------
- ;_O_cursor void O_cursor(int flag) Hide Cursor -> flag=0
- ; Show Cursor -> flag<>0
- ;
- ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!
- ; All functions are FAR. As such, the first operand is 6 off of SP, not
- ; 4 as in a near call. For debugging, I periodically set BH=0x2b (43d)
- and
- ; then do a conditional break in CODEVIEW when BH reg == 0x2b, then
- ; single step thru to look at values - GFD 052392
- ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !!!
-
-
- ;.MODEL MEDIUM
- _TEXT segment word public 'CODE'
- assume CS:_TEXT
-
-
- ;.DATA
- public _O_cursor
-
- ;------------------------------------------------------------------------
- -
- ;----------------------------- _O_cursor
- ---------------------------------
- ; INT 10H, service 01H
- ; --------------------
- ;CH = Top scan line where: Bits 7-6 = 00H
- ; 5 = disable cursor
- ; 4-0 = Top scan line
- ;CL = Bottom scan line : Bits 7 = Undefined
- ; 6-5 = Show cursor
- ; 4-0 - lower scan line
- ;
- ; Default settings: CGA : CH=6, CL=7
- ; MDA/EGA : CH=11, CL=12
- ; MCGA/VGA: CH=13, CL=14
- ;------------------------------------------------------------------------
- -
- _O_cursor proc far
- push bp ;Save base pointer since I change it
- mov bp,sp ;Get the stack pointer to get at parms
- push si
- push di
- ; mov bh,2bh ;43 - DEBUG in codeview
- mov cx,0
- mov cx,[bp+6] ;get the flag
- cmp cx,0000h ;
- je INVIS ;If (Invisible cursor)...
- jmp NORMAL ;else /* Normal cursor */
- INVIS LABEL FAR
- mov ch,20H ;Enable bit 5
- mov cl,00h
- jmp ENDCUR
- NORMAL LABEL FAR
- mov ch,6 ;Use CGA dflt
- mov cl,7 ;Use CGA dflt and enable cursor
- jmp ENDCUR
- ENDCUR LABEL FAR
- mov ah,01h ;Set Text Mode Cursor Size service
- int 10H ;BIOS video interrupt
- pop di ;Restore pushed parms
- pop si
- pop bp
- ret
- _O_cursor endp
-
- >
- >--
- >
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- =-=-
- > * Matt Giddings Internet: mcgiddin@alpha.delta.edu
- *
- > * ELeCTrO-ZiNE BBS Fidonet : 1:249/500 BBS/FAX
- (517)672-4655 *
- >
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- =-=-
-
- Regards,
- Greg DiGiorgio
-
-